<?php

function obterProdutoPeloId($id){
		$con = mysqli_connect ( "localhost", "root", "", "lifeway" );
		// Check connection
		if (mysqli_connect_errno ()) {
			echo "Failed to connect to MySQL: " . mysqli_connect_error ();
		}

		$result = mysqli_query ( $con, "SELECT * FROM produtos WHERE id = " . $id );

		$arr = array ();

		while ( $row = mysqli_fetch_array ( $result ) ) {
			//var_dump($row);
			array_push ( $arr, $row );
		}

		mysqli_close ( $con );

		return $arr;	
}
?>

